#include "criminal.h"


int main()
{
BITMAP *Buffer; 
BITMAP *Background;

image image1;
image image2;
image image3;
image image4;
image image5;
image image6;
image image7;
image image8;
image image9;
image image10;
image image11;
image image12;

BITMAP* curseur;

box box1;
box box2;
box box3;
box box4;
box box5;
box box6;
box box7;

BITMAP* GO;


/* General initialization function */
allegro_init();
if (install_keyboard() == -1) {
allegro_message("Error! %s", allegro_error);
return -1;
}
set_color_depth(16);
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0) != 0) {
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); /* here’s the command for text mode */
allegro_message("Unable to initialize video mode!\n%s\n", allegro_error);
return 1;
}

install_mouse() ;
if (install_mouse () == -1)
{
allegro_message("Erreur ! %s", allegro_error) ;
return -1 ;
}

Buffer = create_bitmap(800, 600);
Background = load_bitmap("background.bmp", NULL);


load_images(&image1, &image2, &image3, &image4, &image5, &image6, &image7, &image8, &image9, &image10, &image11, &image12, GO, &box1, &box2, &box3, &box4, &box5, &box6, &box7, curseur);
curseur = load_bitmap("curseur.bmp", NULL);

if (image1.img == NULL && Background == NULL /*&& image2.img == NULL */&& image3.img == NULL &&/* image4.img == NULL && image5.img == NULL && image6.img == NULL  && /* image7.img == NULL  && image8.img == NULL && image9.img == NULL && image10.img == NULL && image11.img == NULL && image12.img == NULL  &&*/ box1.bx == NULL && box2.bx == NULL  && box3.bx == NULL && box4.bx == NULL && box5.bx == NULL && box6.bx == NULL && box7.bx == NULL && GO == NULL )
 {
allegro_message("could not load images");
allegro_exit();
}

init_images(&image1, &image2, &image3, &image4, &image5, &image6, &image7, &image8, &image9, &image10, &image11, &image12, &box1, &box2, &box3, &box4, &box5, &box6, &box7);

while(!key[KEY_ESC])
{

draw_sprite(Buffer, curseur, 0, 0);
draw_sprite(Buffer, Background, 0, 0);


draw_images(&image1, &image2, &image3, &image4, &image5, &image6, &image7, &image8, &image9, &image10, &image11, &image12, GO, &box1, &box2, &box3, &box4, &box5, &box6, &box7, curseur, Buffer);

clic(&image1, &image2, &image3, &image4, &image5, &image6, &image7, &image8, &image9, &image10, &image11, &image12, GO, &box1, &box2, &box3, &box4, &box5, &box6, &box7, curseur, Buffer);


blit(Buffer, screen, 0, 0, 0, 0, SCREEN_W, SCREEN_H);
}
readkey();

destroy_bitmap(Buffer);
return 0;


}
END_OF_MAIN();
